devfandomcom-20200223-history
Notiplus
| Code = Notiplus.js | Languages = English (supports other languages) | Status = archive }} notiplus is a script that lets you add localized wiki-specific notifications alongside Wikia's global notifications. It supports start dates and duration for each notification and some wiki-formatting. You can also set whether to have visitors to your wiki opt-in to the notifications (currently it's a one-off deal). Installation Options You can set a few settings by adding the following lines before the calling importArticles: // Namespace for notiplus window.notiplus = window.notiplus || {}; // Settings for notiplus notiplus.url = mw.util.getUrl('Project:Notiplus', { action: 'render' }); notiplus.cookiePrefix = 'notiplus'; notiplus.consentRequired = true; notiplus.reverseOrder = false; notiplus.lang = 'en'; The explanation for the above settings is as follows: ; notiplus.url * Sets the URL of the page that contains the notifications * This must be a local URL generated by mw.util.getUrl function (i.e. mw.util.getUrl('PageNames', { URLparameter: 'value' })) * '{ action: 'render' }' at the end is required * Default: "mw.util.getUrl('Project:Notiplus', { action: 'render' })" : See the adding notifications section on how to add notifications ; notiplus.cookiePrefix * The prefix to set the cookies used by notiplus. Useful to group cookies for easier searching with cookie management browser extensions. * ''Should not contain spaces, commas or semicolons.'' * Using your wiki's name or initials is recommended * Default: "notiplus" ;notiplus.consentRequired * If true, then notiplus will need your wiki's users' consent to function. * Default: true ;notiplus.reverseOrder * By default, Wikia notifications are laid out from left to right – added notifications will push the ones before it to the left. * When set to true, it reverses this by pre-pending notiplus notifications to the list. * Default: false ;notiplus.lang * Specifies the interface language (currently used only for the consent popup) * See the language support section for a list of languages currently supported * Default: "en" for English Adding notifications By default, the notification page that notiplus uses is Project:Notiplus. This can be changed by changing the notiplus.url setting as described above. Adding a notification is simply a matter of placing wikitext in the following format to the page: YOUR NOTIFICATION HERE. Most wikitext are supported. *unfortunately #lists ;aren't :supported. Where: ;id :Unique id for that particular notification item. This will be used on both interface and cookie handling. :ids '''must only contain' letters for the first character, and any of the following afterwards:'' :*letters and numbers (A-Z, a-z, 0-9) :*dashes (-) :*colons (:) :*periods (.) :''Do not use spaces, semicolons (;), commas (,) or equal signs (=)!'' ;data-start :Start date of the notification. The notification will not be displayed earlier than this date. :To avoid possible ambiguity, set the time and timezone to UTC e.g. "31 October 2015 12:00:00 UTC". ;data-end (optional) :End date of the notification. Notifications with the end date past the current date will not be displayed. :If omitted, "data-expires" will be used to calculate the end date. ;data-expires :Defines how many days the cookies are stored for each notification. :If "data-end" is not given, this will be used to determine the end date for the notification, calculated as (start + days). :Note that if this is set less than the day span between "data-start" and "data-end", the notification might get displayed again later, as the cookie expires. :Defaults to 30 days You can add an unlimited number of notifications by simply repeating the above format, changing the ID, text and start dates of each one. Using templates To simplify and make the notifications consistent you can create a template page (e.g. Template:Notiplus) which contains the following: } and then call the template in the notification page: Limitations *Wikia only displays paragraphs within their notification balloon. Lists are not supported. *For the above reason the empty lines after the start and before the closing div tag are required. *To make a list lookalike each item needs to be a separate paragraph, and the numbering added manually **example: 1) Item text here. Language support Curently notiplus supports the following languages: *English (en) – by author Feel free to contribute to the translation of the script by posting in the talk page. Look for the "i18n" section in the code to find out the strings used and needed translation. See also * WikiaNotification